﻿using System;
using System.Collections.Generic;
using System.Text;
using s3pi.Interfaces;

namespace s3piwrappers.SceneGraph
{
    public interface IResourceNode
    {
        /// <summary>
        /// The original identifying resource key
        /// of the resource data contained within this node.
        /// </summary>
        IResourceKey OriginalKey { get; }

        /// <summary>
        /// The resource data contained within this node
        /// that is changed by this node's child connections
        /// and written to the resource graph's package.
        /// </summary>
        IResource Resource { get; }

        /// <summary>
        /// This function makes extra changes to
        /// the resource data contained with this node
        /// based on the new resource key for this node,
        /// after all child connections have made their changes.
        /// </summary>
        /// <remarks>
        /// This is mainly for internally kindred RCOL ChunkEntry 
        /// and other exceptional cases that aren't handled by 
        /// self-referencing <see cref="IResourceConnection"/>s.
        /// </remarks>
        bool SetRK(IResourceKey newKey, IResourceKey originalKey);

        /// <summary>
        /// This function makes any and all final changes
        /// to the resource data contained within this node
        /// before it is written to the final package.
        /// </summary>
        /// <returns>true if changes were successfully
        /// committed to the resource data, otherwise false</returns>
        bool CommitChanges();

        /// <summary>
        /// 
        /// </summary>
        /// <remarks><para>
        /// All resource connections generated by this function
        /// will have their child node's resource data 
        /// either cloned or created from scratch.
        /// If a resource referenced in this node's resource data 
        /// isn't supposed to be cloned or created from scratch, 
        /// don't create a connection to it.
        /// </para><para>
        /// </para></remarks>
        List<IResourceConnection> SlurpConnections(object constraints);

        /// <remarks>
        /// This is ultimately a static function,
        /// and it should be implemented as if it is static,
        /// in order to reduce code execution time.
        /// </remarks>
        List<IResourceKinHelper> CreateKinHelpers(object constraints);

        List<IResourceStblHandle> SlurpStblHandles(object constraints);
    }
}
